package com.dogegg.lbbopenapi.exception;

public class OpenApiServiceException extends RuntimeException{

    private int code = -1;

    public OpenApiServiceException(String message) {
        super(message);
    }

    public OpenApiServiceException(String message, int code) {
        super(message);
        this.code = code;
    }

    public OpenApiServiceException(String message, Throwable cause) {
        super(message, cause);
    }

    public int getCode() {
        return code;
    }

    public static OpenApiServiceException errorCode(ErrorCodeEnum codeEnum){
        return new OpenApiServiceException(codeEnum.getMessage(),codeEnum.getCode());
    }
}
